package action;

import dao.DaoFactory;
import dao.UserDao;
import entity.User;

public class Login {
	private String userName;
	private String passWord;
	public String execute(){
		UserDao dao = DaoFactory.getInstance(UserDao.class);
		try {
			User u = dao.findByUserName(userName);
			if(u!=null){
				if(u.getPassWord().equals(passWord)){
					return "success";
				}
			}
		} catch (Exception e) {
			e.printStackTrace();
		}
		return "fail";
	}
	public String getUserName() {
		return userName;
	}
	public String getPassWord() {
		return passWord;
	}
	public void setUserName(String userName) {
		this.userName = userName;
	}
	public void setPassWord(String passWord) {
		this.passWord = passWord;
	}
	
}
